using System;
using NUnit.Framework;

namespace NAsserter.Tests
{
    public class AssertThat_IsNotNullOrEmpty : AssertionHelper
    {
        public void string_that_is_valid()
        {
            AssertThat.Argument("FooBar", "firstName").IsNotNullOrEmpty();
        }

        public void non_null_value_that_is_not_string()
        {
            AssertThat.Argument(DateTime.Now, "dateOfBirth").IsNotNullOrEmpty();
        }

        [Test]
        public void string_that_is_emtpy()
        {
            // Why would someone do this?  I don't know, but just make sure it doesn't break
            Expect(
                () => AssertThat.Argument(string.Empty, "firstName").IsNotNullOrEmpty(),
                Throws.ArgumentException
                    .With.Message.Contains("firstName")
                    .And.Property("ParamName").Contains("firstName"));
        }

        [Test]
        public void string_that_is_null()
        {
            Expect(
                () => AssertThat.Argument((string) null, "firstName").IsNotNullOrEmpty(), 
                Throws.TypeOf<ArgumentNullException>()
                    .With.Message.Contains("firstName")
                    .And.Property("ParamName").Contains("firstName"));
        }

        [Test]
        public void non_string_value_that_is_null()
        {
            // Why would someone do this?  I don't know, but just make sure it doesn't break
            Expect(
                () => AssertThat.Argument((DateTime?)null, "dateOfBirth").IsNotNullOrEmpty(),
                Throws.TypeOf<ArgumentNullException>()
                    .With.Message.Contains("dateOfBirth")
                    .And.Property("ParamName").Contains("dateOfBirth"));
        }
    }
}